<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script type="text/javascript">
  // 伪数组
  var obj = {
    0:1,
    1:100,
    2:200,
    3:300,
    length:4
  }

  // 方式一：
  // obj['4'] = 30
  // obj.length ++
  // console.dir(obj)

  // 方式二：
  Array.prototype.push.call(obj,30)
  Array.prototype.splice.call(obj,0,3)
  console.dir(obj)


  /* 应用2： 借用Object的toString方法 */
  var obj = {
    name:'zs'
  }

  console.log(obj.toString()); // [object Object]

  var arr = [5, 9]
  console.log(arr.toString()) // 5,9

  console.log(Object.prototype.toString.call(arr)); // [object Array]

  </script>
</body>
</html>